import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hc_bot_pro/common/routes.dart';

import 'index.dart';

class SettingPage extends GetView<SettingController> {
  const SettingPage({super.key});

  // 主视图
  Widget _buildView() {
    return ListView(
      children: [
        ListTile(title: Text("version"), trailing: Text(controller.version)),
        Divider(),
        ListTile(title: Text("host"), trailing: Text(controller.host)),
        Divider(),
        ListTile(
          title: Text("guide"),
          trailing: Icon(Icons.arrow_forward_ios),
          onTap: () {
            Get.toNamed(Routes.kGuideSetting);
          },
        ),
        Divider(),
        ListTile(
          title: Text("guide test"),
          trailing: Icon(Icons.arrow_forward_ios),
          onTap: controller.testGuide,
        ),
        Divider(),
        ListTile(
          title: Text("Welcome phase"),
          trailing: Icon(Icons.arrow_forward_ios),
          onTap: controller.changeWelcomPhase,
        ),
      ],
    );
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<SettingController>(
      init: SettingController(),
      id: "setting",
      builder: (vc) {
        return Scaffold(
          appBar: AppBar(title: Text(vc.title)),
          body: SafeArea(child: _buildView()),
        );
      },
    );
  }
}
